package com.biaobiaoqi.scoreanalysis.administrator.action;

import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.biaobiaoqi.scoreanalysis.hibernate.bean.Course;
import com.biaobiaoqi.scoreanalysis.service.ICourseService;
import com.opensymphony.xwork2.ActionSupport;

public class ListCourse extends ActionSupport {
	private static final Log log = LogFactory.getLog(ListCourse.class);
	private static final long serialVersionUID = 7479996473248500327L;
	@Resource
	ICourseService courseService;

	private int currentPage = 0;
	private List<Course> list;

	public String execute() {
		log.debug("list course, current page:" + currentPage);
		try {
			list = courseService.listAllCourse(currentPage * 9, 9);
			return SUCCESS;
		} catch (Exception e) {
			log.error("list course failed", e);
			return ERROR;
		}
	}

	public ICourseService getCourseService() {
		return courseService;
	}

	public void setCourseService(ICourseService courseService) {
		this.courseService = courseService;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public List<Course> getList() {
		return list;
	}

	public void setList(List<Course> list) {
		this.list = list;
	}
}
